<template>
	<view>
		<view @click="openUserInfo" style="display: flex;flex-direction: column;justify-content: center;align-items: center;">
			<u--image :showLoading="true" :src="userInfo.avatarUrl.length>0?ptUrl+userInfo.avatarUrl:'/static/defaultAvatar.png'" width="80px" height="80px"  shape="circle"></u--image>
			<view>{{userInfo.nickName}}</view>
		</view>
		<view>
			<u-cell-group>
				<u-cell icon="map-fill" title="我的地址" :isLink="true" url="/pages/user/component/address"></u-cell>
				<u-cell icon="minus-square-fill" title="我的评价" :isLink="true" url="/pages/order/ShowOrderEvaluates"></u-cell>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	import {
		ptUrl
	} from '@/utils/env.js'
	export default {
		data() {
			return {
				userInfo:{},
				ptUrl: ptUrl,
			}
		},
		onShow() {
			this.getUserinfo(false)
		},
		methods: {
			getUserinfo(refresh){
				this.$http("/wx-user/userinfo","GET",{refresh:refresh}).then(res=>{
					this.userInfo = res.data.data
				})
			},
			openUserInfo(){
				uni.navigateTo({
					url:'/pages/user/component/userInfo'
				})
			},
		},
	}
</script>

<style>
</style>
